package cn.cs.service;

import cn.cs.mapper.AgentTypeMapper;
import cn.cs.mapper.CapitalPoolDetailsMapper;
import cn.cs.pojo.AgentType;
import cn.cs.pojo.CapitalPoolDetails;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class CapitalPoolDetailsService {

    @Resource
    private CapitalPoolDetailsMapper capitalPoolDetailsMapper;

    @RequestMapping(value = "/getCapitalPoolDetailsById", method = RequestMethod.POST)
    public CapitalPoolDetails getCapitalPoolDetailsById(@RequestParam("id") String id) throws Exception{
        return capitalPoolDetailsMapper.getCapitalPoolDetailsById(id);
    }

    @RequestMapping(value = "/getCapitalPoolDetailsListByMap", method = RequestMethod.POST)
    public List<CapitalPoolDetails> getCapitalPoolDetailsListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return capitalPoolDetailsMapper.getCapitalPoolDetailsListByMap(param);
    }

    @RequestMapping(value = "/getCapitalPoolDetailsCountByMap", method = RequestMethod.POST)
    public Integer getCapitalPoolDetailsCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return capitalPoolDetailsMapper.getCapitalPoolDetailsCountByMap(param);
    }

    @RequestMapping(value = "/addCapitalPoolDetails", method = RequestMethod.POST)
    public Integer addCapitalPoolDetails(@RequestBody CapitalPoolDetails capitalPoolDetails) throws Exception{
        return capitalPoolDetailsMapper.insertCapitalPoolDetails(capitalPoolDetails);
    }

    @RequestMapping(value = "/modifyCapitalPoolDetails", method = RequestMethod.POST)
    public Integer modifyCapitalPoolDetails(@RequestBody CapitalPoolDetails capitalPoolDetails) throws Exception{
        return capitalPoolDetailsMapper.updateCapitalPoolDetails(capitalPoolDetails);
    }

    @RequestMapping(value = "/deleteCapitalPoolDetailsById", method = RequestMethod.POST)
    public Integer deleteCapitalPoolDetailsById(@RequestParam("id") String id) throws Exception{
        return capitalPoolDetailsMapper.deleteCapitalPoolDetailsById(id);
    }
}
